package com.followmeandroid.messages;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>Title: FindFriendRequest</p>
 * <p>Description: This class contains the data necessary
 * to send the server a request for pulling up a list of
 * friend candidates.</p>
 * @author Adam Drews
 * @email adam.drews@my.uwrf.edu
 * @date 11/22/2014
 * @team Tyler Johnson
 * @email tyler.johnson@my.uwrf.edu
 * @team Nicholas Thorp
 * @email nicholas.thorp@my.uwrf.edu
 */
public class FindFriendRequest extends ARequestBase {
    private String search;

    /**
     * Constructor for a request to find a friend, with
     * a the string to be used as a query as the parameter.
     * @param searchIn      The search query value to be used in the request.
     */
    public FindFriendRequest(String searchIn){
        search = searchIn;
    }

    /**
     * Returns the contents of the search query for the find
     * friend request.
     * @return search       The contents of the search query.
     */
    public String getSearch() {
        return search;
    }

    /**
     * Sets the contents of the query for the find friend request.
     * @param search        The contents for the search query.
     */
    public void setSearch(String search) {
        this.search = search;
    }

    /**
     * Returns a list of name value pairs for constructing a JSON
     * file to be sent to the server, noting the kind of field, and
     * the value of those fields.
     * @return paramsOut    The names of the fields to be used, and
     *                      their respective values.
     */
    public List<NameValuePair> toKeyValuePairs(){
        List<NameValuePair> paramsOut = new ArrayList<NameValuePair>();
        paramsOut.add(new BasicNameValuePair("search",search));
        paramsOut.add(new BasicNameValuePair("memberid",memberid));
        return paramsOut;
    }
}
